import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/api/element/list',
    method: 'get',
    params: query
  })
}

export function fetchAllElements(query) {
  return request({
    url: '/api/element/list-all',
    method: 'get',
    params: query
  })
}

export function fetchElement(id) {
  return request({
    url: '/api/element/detail',
    method: 'get',
    params: { id }
  })
}

export function createElement(data) {
  return request({
    url: '/api/element/create',
    method: 'post',
    data
  })
}

export function updateElement(data) {
  return request({
    url: '/api/element/update',
    method: 'post',
    data
  })
}
